package be.felnederlands.client;

import static be.felnederlands.client.navigation.NavigationPanel.NavigationElement.HOME;

import org.w3c.css.sac.ContentCondition;

import be.felnederlands.client.content.ContentProvider;
import be.felnederlands.client.navigation.NavigationPanel;
import be.felnederlands.client.navigation.NavigationPanel.NavigationElement;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.event.logical.shared.ValueChangeEvent;
import com.google.gwt.user.client.History;
import com.google.gwt.user.client.HistoryListener;
import com.google.gwt.user.client.ui.Anchor;
import com.google.gwt.user.client.ui.Button;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.TextBox;

public class Felnederlands implements EntryPoint {

	public void onModuleLoad() {
		Button searchButton = new Button("Zoeken");
		TextBox searchField = new TextBox();
		
		NavigationPanel navigationPanel = new NavigationPanel();
		navigationPanel.registerNavigationListener(new ContentProvider());
		History.addHistoryListener(navigationPanel);
		searchField.addStyleName("search-query");
		searchField.addStyleName("big-search-query");

		searchButton.removeStyleName("gwt-Button");
		searchButton.addStyleName("btn");
		searchButton.addStyleName("btn-success");

		RootPanel.get("searchFieldContainer").add(searchField);
		RootPanel.get("searchButtonContainer").add(searchButton);

		searchField.setFocus(true);
		History.newItem(HOME.name());
	}
	
	
	public void onValueChange(ValueChangeEvent<Object> event) {
	    changePage(History.getToken());
	}
	public void changePage(String token) {
		
	}
}
